package com.compass.mobile.ui.viewModel

import androidx.lifecycle.MutableLiveData
import com.compass.mobile.framework.utils.TipsToast
import com.compass.mobile.models.DepartmentBean
import com.compass.mobile.models.Doctor
import com.compass.mobile.models.Inspection
import com.compass.mobile.models.NursingOrder
import com.compass.mobile.models.OrderBean
import com.compass.mobile.network.callback.IApiErrorCallback
import com.compass.mobile.network.manager.ApiManager
import com.compass.mobile.network.viewmodel.BaseViewModel

/**
 * Description：
 * Date:2024/6/27 9:50
 */
class NursingOrderViewModel : BaseViewModel() {

    val nurseOrdersLiveData = MutableLiveData<MutableList<NursingOrder>?>()

    //获取问诊列表
    fun getOrderNurse(type: String?, pageNo: Int, pageSize: Int = 10) {
        launchUIWithResult(responseBlock = {
            ApiManager.api.getOrderNurse(type, pageNo, pageSize)
        }, errorCall = object : IApiErrorCallback {
            override fun onError(code: Int?, error: String?) {
                TipsToast.showTips(error)
            }
        }, successBlock = {
            if (it == null || it.list.isNullOrEmpty()) {
                nurseOrdersLiveData.value=null
            } else {
                nurseOrdersLiveData.value = it.list
            }
        })
    }



}